package com.newlink.building.login.common.widget

import android.widget.CheckBox
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.newlink.building.login.R
import com.newlink.building.login.common.Module_Login_CheckUrlBean

/**
 * Created by xiaodong on 2023/12/19.
 */
class Module_Login_EnvChoiceAdapter(data: MutableList<Module_Login_CheckUrlBean>) :
    BaseQuickAdapter<Module_Login_CheckUrlBean, BaseViewHolder>(
        R.layout.env_choice_item_new, data
    ) {
    init {
        addChildClickViewIds(R.id.env_container)
    }

    override fun convert(holder: BaseViewHolder, item: Module_Login_CheckUrlBean) {
        holder.setText(R.id.env_btn, item.displayName)
        val checkBox = holder.getView<CheckBox>(R.id.env_btn)
        holder.setTextColor(
            R.id.env_btn,
            if (item.isChecked) context.getColor(R.color.white) else context.getColor(R.color.color_303030)
        )
        checkBox.isChecked = item.isChecked
    }
}